﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
namespace WPFExcelReport
{
    public partial class TKSAM02
    {

        public TKSAM02()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VAMSTAMM();
            this.DataContext = MV;
            InitializeComponent();
        }
        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);

        }
        public override void QueryCommand(object sender, RoutedEventArgs e)
        {
            if (KRS.Length < 2)
                return;
            if (LFD.Length < 6)
                return;
            TBMain.Clear();
            dwData = TMV.TBMain.NewRow();
            dwData["AMMANDANT"] = app.Mandant;
            dwData["AMKSTKRS"] = "AND AMKSTKRS= '" + KRS.Substring(0, 2) + "'";
            dwData["AMKST"] = "AND AMKST= '" + LFD.Substring(2, 4) + "'";
            SResult = TMV.QAM03(dwData);
            MergeData(SResult, false);
            base.QueryCommand(sender, e);
        } 
        public override void OnEXAUFChg(string vlaue)
        {
            TBMain.Clear();
            if (EXAUF.Length < 6)
                return;
            dwData = TBMain.NewRow();
            dwData["AMMANDANT"] = app.Mandant;
            dwData["AMKSTKRS"] = "AND AMKSTKRS= '" + EXAUF.Substring(0, 2) + "'";
            dwData["AMKST"] = "AND AMKST= '" + EXAUF.Substring(2, 4) + "'"; 
            SResult = TMV.QAM03(dwData);
            MergeData(SResult, true);
            base.OnEXAUFChg(vlaue);
        }
    }
}
